﻿using UnityEngine;
using System.Collections;

public class NormalBullet : MonoBehaviour {

	public float BulletSpeed = 10.0f;

	private Vector2 direction;
	private Vector2 movement = new Vector2(0.0f, 0.0f);


	// Use this for initialization
	void Start () {
		Destroy(gameObject, 10);
	}
	
	// Update is called once per frame
	void Update () 
	{
		if (this.direction != Vector2.zero)
		{
			movement.x = BulletSpeed * direction.x;
			movement.y = BulletSpeed * direction.y;
		}
	}
	
	void FixedUpdate()
	{
		rigidbody2D.velocity = movement;
	}

	public void SetBulletDirection(Vector2 theDirection)
	{
		this.direction = new Vector2(theDirection.x, theDirection.y);
	}


}
